{% extends "personal_center/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        tr {
            height: 35px;
        }
        th {
            text-align: center;
        }
        table {
            table-layout: fixed;
        }
        td:first-child, th:first-child {
            position: sticky;left: 0;z-index: 1;
        }
        thead tr th {
            position: sticky;top: 0;background-color: #E8E8E8;
        }
        th:first-child {
            z-index: 2;
        }
        .model_li {
            color: #3f414d;width: 25%;cursor: pointer;display: none;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .search {
            width: 300px;display: flex;float: right;margin: 10px 0;margin-right: 1%;
        }
        .search input {
            vertical-align: middle;float: left;height: 30px;width: 230px;outline: none;border: 1px solid #0070c1;box-sizing: border-box;border-bottom-left-radius: 3px;border-top-left-radius: 3px;
        }
        .search button {
            float: right;flex: 1;height: 30px;width: 70px;line-height: 30px;background-color: #0070c1;color: white;border-style: none;outline: none;border-bottom-right-radius: 3px;border-top-right-radius: 3px;
        }
        .search button i {
            font-style: normal;
        }
        .search button:hover {
            font-size: 16px;
        }
        #addForm {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }

        #title {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 50px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        .div_clase{
            display: inline-block;width: 300px;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;
        }
        .a_tag_cla{
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;margin: 5px 0;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div class="headline">
        <div id="my_application_tab" onclick="change_mind('my_application')" class="tab_top top_tag">
            议题详情
        </div>
        <div id="new_issues_tab" onclick="change_mind('new_issues')" class="tab_top">
            附件
        </div>
        <div id="examine_tab" onclick="change_mind('examine')" class="tab_top">
            审批详情
        </div>

        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>
{#        <div id="approver_but" style="float: right;width: 150px;height: 40px;text-align: center;">#}
{#            <button id="summit_but" onclick="summit_data()" style="width: 100px;height: 30px;line-height: 30px;margin-top: 5px;background-color: #1E90FF;color: white;border: #1E90FF solid 1px;border-radius: 3px;">提&nbsp;&nbsp;交</button>#}
{#        </div>#}
    </div>

    <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
         style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
        <button id="summit_but" onclick="summit_data()" class="button_for_control">
            提交
        </button>
        <button id="is_stop" onclick="operate_button(this.id)" class="button_for_control">
            终止
        </button>
    </div>

    <div id="my_application" style="width: 100%;height: 93%;overflow: auto;background-color: white;">
        <div style="width: 100%;height: 40px;line-height: 40px;text-align: center;">
            <h3 id="h_title"></h3>
        </div>
        <hr>
        <div style="width: 100%;height: 93%;overflow: auto;margin-top: 0.5px;">
            <div style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;padding-right: 1%;">
                申请详情
            </div>
            <div style="width: 100%;">
                <table style="width: 90%;margin-left: 5%;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">提交人</td>
                        <td id="tjr" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: left;padding-left: 1%;border-top: none;"></td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">提交科室</td>
                        <td id="tjks" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: left;padding-left: 1%;border-top: none;"></td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">议题编号</td>
                        <td id="bh" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: left;padding-left: 1%;border-top: none;"></td>
                    </tr>
                    {% if obj.type == "yb" %}
                        <tr id="topic_pay_select" style="width: 100%;">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>议题类型</td>
                            <td id="topic_type" {% if obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" %}colspan="5"{% elif obj.topic_type == "3" or obj.topic_type == "7" %}colspan="3"{% endif %} style="{% if obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" %}width: 85%{% elif obj.topic_type == "1" or obj.topic_type == "2" %}width: 25%{% elif obj.topic_type == "3" %}width: 53%{% else %}width: 25%{% endif %};height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                                <select name="" id="topic_type_select" style="width: 100%;height: 100%;border: none;outline: none;" onchange="select_topic_type()">
                                    <option value="0">请选择议题类型</option>
                                    <option value="1" {% if obj.topic_type == "1" %}selected{% endif %}>付款类</option>
                                    <option value="2" {% if obj.topic_type == "2" %}selected{% endif %}>经济合同类</option>
                                    <option value="3" {% if obj.topic_type == "3" %}selected{% endif %}>项目类</option>
                                    <option value="4" {% if obj.topic_type == "4" %}selected{% endif %}>文件类</option>
                                    <option value="5" {% if obj.topic_type == "5" %}selected{% endif %}>方案类</option>
                                    {% if zbb_flag == 'true' %}
                                        <option value="7" {% if obj.topic_type == "7" %}selected{% endif %}>招标采购类</option>
                                    {% endif %}
                                    <option value="6" {% if obj.topic_type == "6" %}selected{% endif %}>其他事项</option>
                                </select>
                            </td>

                            <td id="pay_type_title" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;{% if obj.topic_type != "1" %}display: none{% endif %};">付款类型</td>
                            <td id="pay_type" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;{% if obj.topic_type != "1" %}display: none{% endif %};">
                                <select name="" id="pay_type_select" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="0">请选择付款类型</option>
                                    <option value="1" {% if obj.pay_type == "1" %}selected{% endif %}>合同付款</option>
                                    <option value="2" {% if obj.pay_type == "2" %}selected{% endif %}>固定资产/维修维保付款</option>
                                    <option value="3" {% if obj.pay_type == "3" %}selected{% endif %}>材料付款</option>
                                    <option value="4" {% if obj.pay_type == "4" %}selected{% endif %}>餐补付款</option>
                                    <option value="5" {% if obj.pay_type == "5" %}selected{% endif %}>学科经费</option>
                                    <option value="6" {% if obj.pay_type == "6" %}selected{% endif %}>科研经费</option>
                                    <option value="7" {% if obj.pay_type == "7" %}selected{% endif %}>一般付款</option>
                                    <option value="8" {% if obj.pay_type == "8" %}selected{% endif %}>工会付款</option>
                                </select>
                            </td>

                             <td id="contract_type_title" style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;{% if obj.topic_type != "2" %}display: none{% endif %};">合同类型</td>
                             <td id="contract_type" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;{% if obj.topic_type != "2" %}display: none{% endif %};">
                                 <select name="" id="contract_type_select" style="width: 100%;height: 100%;border: none;outline: none;">
                                     <option value="0">请选择合同类型</option>
                                     <option value="1" {% if obj.contract_type == "1" %}selected{% endif %}>服务类</option>
                                     <option value="2" {% if obj.contract_type == "2" %}selected{% endif %}>货物类</option>
                                     <option value="3" {% if obj.contract_type == "3" %}selected{% endif %}>工程类</option>
                                     <option value="4" {% if obj.contract_type == "4" %}selected{% endif %}>其他类</option>
                                 </select>
                             </td>

                            <td id="whether_outweigh_title" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;{% if obj.topic_type == "3" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" %}display: none{% endif %}">是否转党委会</td>
                            <td id="whether_outweigh" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;{% if obj.topic_type == "3" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" %}display: none{% endif %};">
                                <input type="radio" name="whether_outweigh_20" value="1" {% if obj.whether_outweigh == "1" %}checked{% endif %}> 是
                                <input type="radio" name="whether_outweigh_20" value="0" style="margin-left: 10px;" {% if obj.whether_outweigh == "0" %}checked{% endif %}> 否
                            </td>

                            <td id="WhetherBidTitle" style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;{% if obj.topic_type == "1" or obj.topic_type == "2" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" or obj.topic_type == "7" %}display: none{% endif %};">是否招标</td>
                            <td id="WhetherBid" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;{% if obj.topic_type == "1" or obj.topic_type == "2" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" or obj.topic_type == "7" %}display: none{% endif %};">
                                <input type="radio" name="whether_bid_or_not" value="1" {% if obj.whether_bid == "1" %}checked{% endif %}> 是
                                <input type="radio" name="whether_bid_or_not" value="0" style="margin-left: 10px;" {% if obj.whether_bid == "0" %}checked{% endif %}> 否
                            </td>
                        </tr>

                        <tr id="payment_information" style="width: 100%;{% if obj.topic_type == "2" or obj.topic_type == "3" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" or obj.topic_type == "7" %}display: none{% endif %};">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">收款单位</td>
                            <td id="Payee" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true">{{ obj.Payee }}</td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">收款账号</td>
                            <td id="receiving_account" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true">{{ obj.receiving_account }}</td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">开户行</td>
                            <td id="opening_bank" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;" contenteditable="true">{{ obj.opening_bank }}</td>
                        </tr>

                        <tr id="contract_countersigning_tr" style="width: 100%;{% if obj.topic_type == "1" or obj.topic_type == "3" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" or obj.topic_type == "7" %}display: none{% endif %};">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">对方单位</td>
                            <td id="opposite_unit" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true">{{ obj.Payee }}</td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">合同名称</td>
                            <td id="contract_name" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true">{{ obj.contract_name }}</td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">合同编号</td>
                            <td id="contract_number" style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;" contenteditable="true">{{ obj.contract_number }}</td>
                        </tr>

                        <tr id="payment_capitalization" style="width: 100%;{% if obj.topic_type == "2" or obj.topic_type == "3" or obj.topic_type == "4" or obj.topic_type == "5" or obj.topic_type == "6" or obj.topic_type == "7" %}display: none{% endif %};">
                            <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">申请金额</td>
                            <td id="application_amount" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;" onblur="change_daxie(this)" contenteditable="true">{{ obj.application_amount }}</td>
                            <td style="width: 13%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">金额大写</td>
                            <td id="amount_words" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;">{{ obj.amount_words }}</td>
                            <td style="width: 12%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;">经费来源</td>
                            <td style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;">
                                <select name="" id="funding_source" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="0">请选择经费来源</option>
                                    <option value="1" {% if obj.funding_source == "1" %}selected{% endif %}>自有经费</option>
                                    <option value="2" {% if obj.funding_source == "2" %}selected{% endif %}>学科经费</option>
                                    <option value="3" {% if obj.funding_source == "3" %}selected{% endif %}>科研经费</option>
                                    <option value="4" {% if obj.funding_source == "4" %}selected{% endif %}>财政拨款</option>
                                    <option value="5" {% if obj.funding_source == "5" %}selected{% endif %}>贴息贷款</option>
                                    <option value="6" {% if obj.funding_source == "6" %}selected{% endif %}>专项债券</option>
                                    <option value="7" {% if obj.funding_source == "7" %}selected{% endif %}>工会经费</option>
                                </select>
                            </td>
                        </tr>
                    {% endif %}
                    <tr id="xb_ks" style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">协办科室</td>
                        <td id="xieban" {% if obj.topic_type == "1" %}colspan="5"{% endif %} style=" {% if obj.topic_type == "1" %}width: 85%;{% endif %}height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;" onclick="show_model()"></td>
                        <td id="ysje1" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;{% if obj.topic_type == "1" %}display: none;{% endif %}">预算金额(不超过)</td>
                        <td id="ysje" style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: left;padding-left: 1%;border-top: none;outline: none;{% if obj.topic_type == "1" %}display: none;{% endif %}" contenteditable="true"></td>
                        <td id="jfly1" style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;{% if obj.topic_type == "1" %}display: none;{% endif %}">经费来源</td>
                        <td id="jfly" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: left;padding-left: 1%;border-top: none;outline: none;{% if obj.topic_type == "1" %}display: none;{% endif %}" contenteditable="true"></td>
                    </tr>
                </table>
                <table id="fenguan_yes" style="width: 90%;margin-left: 5%;display: none;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">分管领导</td>
                        <td id="" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">
                            <select name="" id="fg_people" style="width: 100%;height: 100%;border: none;outline: none;">
                                <option value="">请选择分管领导</option>
                                {% for leader in leaders %}
                                    <option value="{{ leader.id }}">{{ leader.real_name }}</option>
                                {% endfor %}
                            </select>
                        </td>
                    </tr>
                </table>
                <table style="width: 90%;margin-left: 5%;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">议题名称</td>
                        <td id="ytmc" style="width: 50%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" CONTENTEDITABLE="true"></td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">预估用时(分钟)</td>
                        <td id="ygys" style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="true"></td>
                    </tr>
                </table>
            </div>

            {% if objs_count == "true" %}
                <div style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;padding-right: 1%;border-top: none;">
                    院长办公会议题内容
                </div>
                <table style="width: 90%;margin-left: 5%;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 2px;">
                            议题简述
                        </td>
                        <td id="ytnr" colspan="5" style="width: 85%;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;">
                        </td>
                    </tr>
                    <tr id="yt_yj" style="width: 100%;{% if obj.type == 'xz' %} display: none; {% endif %}">
                        <td style="width: 15%;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 2px;">
                            政策依据或调研论证情况
                        </td>
                        <td id="ytyj" colspan="5"
                            style="width: 85%;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;"></td>
                    </tr>
                    <tr id="jj_fa" style="width: 100%;{% if obj.type == 'xz' %} display: none; {% endif %}">
                        <td style="width: 15%;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            拟供选择方案
                        </td>
                        <td id="jjfa" colspan="5"
                            style="width: 85%;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;"></td>
                    </tr>
                </table>
            {% endif %}

            <div style="width: 100%;font-size: 0;">
                <div onclick="jianshu_show()" style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;cursor: pointer;font-size: 16px;">
                    一、议题简述
                </div>

                <div id="yt_js" style="width: 100%;">
                    <script id="editor" type="text/plain" style="width:94.9%;height:300px;margin-left: 5%;outline: none;"></script>
                </div>
                <div id="btns"></div>
            </div>
            <div id="zhengceyiju" style="width: 100%;font-size: 0;">
                <div onclick="yiju_show()" style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;cursor: pointer;font-size: 16px;">
                    二、政策依据或调研论证情况
                </div>

                <div id="yt_yj_ed" style="width: 100%;height: 100%;">
                    <script id="editor1" type="text/plain" style="width:94.9%;height:300px;margin-left: 5%;outline: none;"></script>
                </div>
                <div id="btns1"></div>
            </div>
            <div id="jiejuefangan" style="width: 100%;font-size: 0;">
                <div onclick="jiejuefangan_show()" style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;cursor: pointer;font-size: 16px;">
                    三、拟供选择方案
                </div>

                <div id="jj_fa_yj" style="width: 100%;">
                    <script id="editor2" type="text/plain" style="width:94.9%;height:300px;margin-left: 5%;outline: none;"></script>
                </div>
                <div id="btns2"></div>
            </div>
            <div style="width: 100%;">
                <div style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                    上传附件<span style="color: red;">(注: 议题附件、汇报PPT)</span>
                    <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                        上传文件
                        <input type="file" name="party_main_body" id="party_main_body" >
                    </a>
                </div>
                <table style="width: 90%;margin-left: 5%;">
                    <thead>
                        <tr>
                            <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件名称</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件大小</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传时间</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传人员</td>
                            <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作</td>
                        </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="party_main"></tbody>
                </table>
            </div>
        </div>
    </div>

    <div id="new_issues" style="width: 100%;height: 93%;overflow: auto;display: none;background-color: white;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">附件</div>
            <div id="yt_zhengwen" style="width: 100%;">

            </div>
        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

    <div id="examine" style="width: 100%;height: 93%;overflow: auto;display: none;background-color: white;">
        <div class="right-box" style="width: 100%;height: 95%;margin-top: 0;">
            <div style="height: 93%;width: 100%;overflow: auto;border-bottom: #cccccc solid 1px;background-color: white;">
                <table class="table table-hover table-bordered" style="border-collapse: collapse;width: 100%;table-layout:fixed;">
                    <thead>
                        <tr>
                            <th>审批人</th>
                            <th>审批状态</th>
                            <th>审批时间</th>
                            <th>审批意见</th>
                            <th>签名</th>
                        </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="my_mine_body">
                        {% for k,v in audit_dic.items %}
                            {% for foo in v %}
                                <tr>
                                    <td style="text-align: center;">{{ foo.audit_user }}</td>
                                    <td style="text-align: center;">{{ foo.state_display }}</td>
                                    <td style="text-align: center;">{{ foo.audit_time }}</td>
                                    <td>{{ foo.audit_note }}</td>
                                    <td style="text-align: center;"><img src="{{ foo.signature_picture }}" alt="" style="width: 100px;height: 40px;"></td>
                                </tr>
                            {% endfor %}
                        {% endfor %}
                    </tbody>
                </table>
                <div id="img-display" style="width: 75%;text-align: center;position: fixed;display: none;">
                    <div style="margin-top: 10%;">
                        <img src="../../static/public_file/images/page-img/11.jpg" alt="">
                        <p style="margin: 0;padding: 0;vertical-align: top;">暂无数据</p>
                    </div>
                </div>
            </div>
            <div id="pagination" class="pagination" style="margin-left: 20px;margin-top: 1.5%;"></div>
        </div>
    </div>

    <div id="addForm">
        <!-- 标题 -->
        <div id="title">
            <h5 style="line-height: 50px;width: 15%;margin-left: 1%;display: inline-block;font-size: 18px;">协办科室</h5>
            <div class="search" style="vertical-align: center;display: inline-block;text-align: right;margin-left: 35%;font-size: 14px;">
                <input type="text" placeholder="请输入..." name="" id="search_data" value="">
                <button onclick="search_dep()" id="search_button">搜索</button>
            </div>
            <span onclick="close_models1()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
        </div>
        <hr>
        <div id="processed" style="width: 100%;height: 500px;overflow: auto;vertical-align: top;left: 0;padding-left: 2%;">
            {% for company in company_list %}
                <div style="display: inline-block;width: 300px;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;">
                    <input class="check_box" id="{{ company.name }}({{ company.id }})" type="checkbox"> {{ company.name }}
                </div>
            {% endfor %}
        </div>

        <hr>
        <div style="height: 70px;padding-right: 2%;font-size: 14px;">
            <button onclick="summit_val()" id="model-affirm2" style="border-radius: 3px;height: 30px;float: right;margin-top: 15px;border: #1E90FF solid 1px;background: #1E90FF;color: white;">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </button>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" charset="utf-8" src="../../static/announcements/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../static/announcements/ueditor/1.4.3/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="../../static/announcements/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("sponsor").className = "add-nav-active";
            my_mine();
        };

        var obj_count = {{ objs_count | safe }};
        if (obj_count) {
            var decode = atob('{{ objs_dict.topics_text | safe }}');
            // 编码转字符串
            var content = decodeURI(decode);

            var decode1 = atob('{{ objs_dict.topics_basis | safe }}');
            // 编码转字符串
            var content1 = decodeURI(decode1);
            if ('{{ data_dic.solution | safe }}' !== "空") {
                var decode2 = atob('{{ objs_dict.solution | safe }}');
                var content2 = decodeURI(decode2);      // 编码转字符串
            }

            document.getElementById("ytnr").innerHTML = content.trim();
            document.getElementById("ytyj").innerHTML = content1.trim();
            document.getElementById("jjfa").innerHTML = content2.trim();
        }

        department = "{{ department | safe }}";
        if (department === "医务科" || department === '审计科' || department === "党委办公室" || department === "医院办公室"){
            document.getElementById("fenguan_yes").style.display = "table";
        }

        var flag = "{{ flag | safe }}";
        if (flag){
            document.getElementById("approver_but").style.display="none";
        }

        var ue = UE.getEditor('editor');

        var ue1 = UE.getEditor('editor1');

        var ue2 = UE.getEditor('editor2');

        // 我的申请
        function my_mine() {
            var iss_id = window.location.href.split("id=")[1].replace("#", '');
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('get', "/administrative/TopicsDetailView?id="+String(iss_id), true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send();
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate)
                        if (JsonDate["data_dic"]["number"].indexOf("JYYB") !== -1){
                            document.getElementById("h_title").innerText = "院长办公会议题审批表";
                            document.getElementById("summit_but").setAttribute("onclick", "summit_data1()")
                        }else if (JsonDate["data_dic"]["number"].indexOf("JYDB") !== -1){
                            document.getElementById("h_title").innerText = "党委会议题审批表";
                            document.getElementById("summit_but").setAttribute("onclick", "summit_data()")
                        }else {
                            document.getElementById("h_title").innerText = "行政例会议题审批表";
                            document.getElementById("xb_ks").style.display='none';
                            document.getElementById("zhengceyiju").style.display='none';
                            document.getElementById("jiejuefangan").style.display='none';
                            document.getElementById("summit_but").setAttribute("onclick", "summit_data2()")
                        }

                        document.getElementById("tjr").innerText=JsonDate["data_dic"]["apply_user"];
                        document.getElementById("bh").innerText=JsonDate["data_dic"]["number"];
                        document.getElementById("tjks").innerText=JsonDate["data_dic"]["department"];
                        document.getElementById("ytmc").innerText=JsonDate["data_dic"]["topics_name"];
                        document.getElementById("ygys").innerText=JsonDate["data_dic"]["topics_estimate"];
                        document.getElementById("xieban").innerText=JsonDate["data_dic"]["help_department1"];
                        document.getElementById("ysje").innerText=JsonDate["data_dic"]["ysje"];
                        document.getElementById("jfly").innerText=JsonDate["data_dic"]["jfly"];

                        if (obj_count) {
                            var decode = atob('{{ objs_dict.db_topics_text | safe }}');
                            // 编码转字符串
                            var content = decodeURI(decode);

                            var decode1 = atob('{{ objs_dict.db_topics_basis | safe }}');
                            // 编码转字符串
                            var content1 = decodeURI(decode1);
                            if ('{{ data_dic.db_solution | safe }}' !== "空") {
                                var decode2 = atob('{{ objs_dict.db_solution | safe }}');
                                var content2 = decodeURI(decode2);      // 编码转字符串
                            }
                            UE.getEditor('editor').setContent(content);
                            UE.getEditor('editor1').setContent(content1);
                            if (content2){
                                UE.getEditor('editor2').setContent(content2);
                            }
                        }else {
                            decode = atob(JsonDate["data_dic"]["topics_text"]);
                            // 编码转字符串
                            content = decodeURI(decode);

                            decode1 = atob(JsonDate["data_dic"]["topics_basis"]);
                            // 编码转字符串
                            content1 = decodeURI(decode1);

                            content2 = '';
                            if (JsonDate["data_dic"]["solution"] !== "空"){
                                decode2 = atob(JsonDate["data_dic"]["solution"]);
                                content2 = decodeURI(decode2);      // 编码转字符串
                            }

                            UE.getEditor('editor').setContent(content);
                            UE.getEditor('editor1').setContent(content1);
                            if (content2){
                                UE.getEditor('editor2').setContent(content2);
                            }
                        }

                        if (JsonDate["data_dic"]['main_file_list'].length > 0){
                            document.getElementById("embed_file").setAttribute("src", JsonDate["data_dic"]['main_file_list'][0]["file_path"].replace("mediaTopics", "/media/Topics"));
                        }

                        var yt_zhengwen = document.getElementById("yt_zhengwen");
                        for (var d=0; d<JsonDate["data_dic"]['main_file_list'].length; d++){
                            var div_tag = document.createElement("div");div_tag.style.width="100%";div_tag.style.height="40px";div_tag.style.paddingLeft="2%";div_tag.style.lineHeight="40px";
                            var a_tag = document.createElement("a");a_tag.setAttribute("href", "#");
                            a_tag.innerText = JsonDate["data_dic"]['main_file_list'][d]["file_name"];a_tag.setAttribute("onclick", "chage_yulan(this, '"+JsonDate["data_dic"]['main_file_list'][d]["file_path"]+"')");a_tag.className="a_tag_cla";a_tag.setAttribute("title", JsonDate["data_dic"]['main_file_list'][d]["file_name"])
                            div_tag.appendChild(a_tag);yt_zhengwen.appendChild(div_tag);
                        }
                        creat_table(JsonDate["data_dic"]["main_file_list"])
                     document.getElementById("party_main_body").setAttribute('onChange', "upload_accessory('file1', 'party_main', 'party_main_body','"+JsonDate["data_dic"]["uuid"] +"')")

                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData) {
            var t_table = document.getElementById('party_main');
            for (var i=0; i<JsonData.length; i++){
                var tr = document.createElement("tr");
                var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                td1.innerHTML = i+1;td1.style.textAlign = "center";td1.style.border="#cccccc solid 1px";td1.style.borderTop="none";
                td2.innerHTML = JsonData[i]["file_name"];td2.style.paddingLeft = "1%";td2.style.border="#cccccc solid 1px";td2.style.borderLeft="none";td2.style.borderTop="none";
                td3.innerHTML = JsonData[i]["file_size"];td3.style.textAlign = "center";td3.style.border="#cccccc solid 1px";td3.style.borderLeft="none";td3.style.borderTop="none";
                td4.innerHTML = JsonData[i]["upload_time"];td4.style.textAlign = "center";td4.style.border="#cccccc solid 1px";td4.style.borderLeft="none";td4.style.borderTop="none";
                td5.innerHTML = JsonData[i]["uploader"];td5.style.textAlign = "center";td5.style.border="#cccccc solid 1px";td5.style.borderLeft="none";td5.style.borderTop="none";
                var local_host = window.location.host;
                td6.innerHTML = "<a target='_blank' href='"+JsonData[i]["file_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \""+'party_main'+"\", \""+JsonData[i]["id"]+"\")'>删除</a>";td6.style.textAlign = "center";td6.style.border="#cccccc solid 1px";td6.style.borderLeft="none";td6.style.borderTop="none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                t_table.appendChild(tr);
            }
        }

        // 创建附件列表
        function creat_table1(JsonData) {
            var t_table = document.getElementById('party_main');
            var tr = document.createElement("tr");
            var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
            td1.innerHTML = t_table.children.length+1;td1.style.textAlign = "center";td1.style.border="#cccccc solid 1px";td1.style.borderTop="none";
            td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border="#cccccc solid 1px";td2.style.borderLeft="none";td2.style.borderTop="none";
            td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border="#cccccc solid 1px";td3.style.borderLeft="none";td3.style.borderTop="none";
            td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border="#cccccc solid 1px";td4.style.borderLeft="none";td4.style.borderTop="none";
            td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border="#cccccc solid 1px";td5.style.borderLeft="none";td5.style.borderTop="none";
            var local_host = window.location.host;
            td6.innerHTML = "<a target='_blank' href='"+JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \""+'party_main'+"\", \""+JsonData["id"]+"\")'>删除</a>";td6.style.textAlign = "center";td6.style.border="#cccccc solid 1px";td6.style.borderLeft="none";td6.style.borderTop="none";
            tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
            t_table.appendChild(tr);
        }

        // 删除列表
        function deltr(){
            var tb = document.getElementById('my_mine_body');
            var rowNum=tb.rows.length;
            for (i=0;i<rowNum;i++) {
                tb.deleteRow(i);
                rowNum=rowNum-1;
                i=i-1;
            }
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index+1)
            var arr=['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index=arr.indexOf(ext);
            if (ext_index === -1){
                fujian.innerHTML = '<embed id="embed_file" src="'+file_path+'" type="" style="width: 100%;height: 100%;">'
            }else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0;i<a_tag_list.length; i++){
                a_tag_list[i].style.background='';
            }
            this_.style.background='#cfcfcf';
        }

        function change_mind(ele_id) {
            if (ele_id === "my_application") {
                document.getElementById("my_application").style.display = "inline-block";
                document.getElementById("new_issues").style.display = "none";
                document.getElementById("my_application_tab").className = "tab_top top_tag";
                document.getElementById("new_issues_tab").className = "tab_top";
                document.getElementById("examine").style.display = "none";
                document.getElementById("examine_tab").className = "tab_top";
            }else if (ele_id === "new_issues"){
                document.getElementById("new_issues").style.display = "inline-block";
                document.getElementById("my_application").style.display = "none";
                document.getElementById("my_application_tab").className = "tab_top";
                document.getElementById("new_issues_tab").className = "tab_top top_tag";
                document.getElementById("examine").style.display = "none";
                document.getElementById("examine_tab").className = "tab_top";
            }else {
                document.getElementById("examine").style.display = "inline-block";
                document.getElementById("examine_tab").className = "tab_top top_tag";
                document.getElementById("new_issues").style.display = "none";
                document.getElementById("my_application").style.display = "none";
                document.getElementById("my_application_tab").className = "tab_top";
                document.getElementById("new_issues_tab").className = "tab_top";
            }
        }

        function online_tag() {
            document.getElementById("new_models").style.display="table";
        }

        function close_models() {
            document.getElementById("new_models").style.display="none";
        }

        function jianshu_show() {
            if (document.getElementById("yt_js").style.display === "none"){
                document.getElementById("yt_js").style.display="inline-block";
            }else {
                document.getElementById("yt_js").style.display="none";
            }
        }

        function yiju_show() {
            if (document.getElementById("yt_yj_ed").style.display === "none"){
                document.getElementById("yt_yj_ed").style.display="inline-block";
            }else {
                document.getElementById("yt_yj_ed").style.display="none";
            }
        }

        function jiejuefangan_show() {
            if (document.getElementById("jj_fa_yj").style.display === "none"){
                document.getElementById("jj_fa_yj").style.display="inline-block";
            }else {
                document.getElementById("jj_fa_yj").style.display="none";
            }
        }

        // 上传正文
        function upload_accessory(file_type, tbody_id, accessory_type, bh_id) {
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            var ytbh = bh_id;       // 议题编号
            form.append(file_type, files);
            form.append('number', ytbh);
            form.append('source', "yt");

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        creat_table1(JsonDate)
                    }
                }
            };
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i=0; i<table.children.length; i++){
                table.children[i].children[0].innerHTML=i+1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        function summit_data() {
            var db_ytmc = document.getElementById("ytmc").innerText;       // 议题名称
            var db_bh = document.getElementById("bh").innerText;       // 议题编号
            var db_xb = document.getElementById("xieban").innerText;       // 协办科室
            var db_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var db_ytyj = btoa(encodeURI(UE.getEditor("editor1").getContent()));       // 议题依据
            var db_jjfa = btoa(encodeURI(UE.getEditor("editor2").getContent()));       // 解决方案
            var db_ygys = document.getElementById("ygys").innerText;       // 预估用时(分钟)
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var yj_wenben = UE.getEditor("editor1").getPlainTxt();
            var fa_wenben = UE.getEditor("editor2").getPlainTxt();
            var ysje = document.getElementById("ysje").innerText;       // 预算金额
            var jfly = document.getElementById("jfly").innerText;       // 经费来源

            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            if (department === '医务科' ||  department === "审计科" || department === "党委办公室" || department === "医院办公室"){
                if (!fg_people){
                    alert("请选择分管领导！");
                    return false
                }
            }

            if (!db_ytmc){
                alert("议题名称不能为空");
                return false
             }
            if (!db_ytnr){
                alert("议题内容不能为空");
                return false
             }
            if (!db_jjfa){
                alert("解决方案不能为空");
                return false
             }
            var table = document.getElementById('party_main');

            var db_xb_split = db_xb.split(',');var db_xb_list = [];
            if (db_xb_split.length >= 1){
                for (var a=0; a<db_xb_split.length; a++){
                    if (db_xb_split[a].trim()){
                        db_xb_list.push(db_xb_split[a].split("(")[1].slice(0, -1));
                    }
                }
             }

            if (obj_count) {
                var db_send_str = 'number='+String(db_bh)+'&type='+String("db")+'&topics_name='+String(db_ytmc)+'&topics_text='+String(db_ytnr)+'&topics_basis='+String(db_ytyj)+'&solution='+String(db_jjfa)+'&topics_estimate='+String(db_ygys)+'&nr_wenben='+String(nr_wenben)+'&yj_wenben='+String(yj_wenben)+'&fa_wenben='+String(fa_wenben)+"&ysje="+String(ysje)+"&jfly="+String(jfly)+"&help_department="+JSON.stringify(db_xb_list)+"&PgCount=true"+"&fg_people="+String(fg_people);
            }else {
                db_send_str = 'number='+String(db_bh)+'&type='+String("db")+'&topics_name='+String(db_ytmc)+'&topics_text='+String(db_ytnr)+'&topics_basis='+String(db_ytyj)+'&solution='+String(db_jjfa)+'&topics_estimate='+String(db_ygys)+'&nr_wenben='+String(nr_wenben)+'&yj_wenben='+String(yj_wenben)+'&fa_wenben='+String(fa_wenben)+"&ysje="+String(ysje)+"&jfly="+String(jfly)+"&help_department="+JSON.stringify(db_xb_list)+"&fg_people="+String(fg_people);
            }

            ajax_request(db_send_str);
        }

        function summit_data1() {
            var yb_ytmc = document.getElementById("ytmc").innerText;       // 议题名称
            var yb_bh = document.getElementById("bh").innerText;       // 议题编号
            var yb_xb = document.getElementById("xieban").innerText;       // 协办科室
            var yb_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var yb_ytyj = btoa(encodeURI(UE.getEditor("editor1").getContent()));       // 议题依据
            var yb_jjfa = btoa(encodeURI(UE.getEditor("editor2").getContent()));       // 解决方案
            var yb_ygys = document.getElementById("ygys").innerText;       // 预估用时(分钟)
            var ysje = document.getElementById("ysje").innerText;       // 预算金额
            var jfly = document.getElementById("jfly").innerText;       // 预算金额
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var yj_wenben = UE.getEditor("editor1").getPlainTxt();
            var fa_wenben = UE.getEditor("editor2").getPlainTxt();
            var topic_type_select = document.getElementById("topic_type_select").value;         // 议题类型
            var pay_type_select = "";
            var contract_type_select = "";
            var whether_outweigh_20 = ""
            var Payee = "";
            var receiving_account = "";
            var opening_bank = "";
            var contract_name = "";                                         // 合同名称
            var contract_number = "";                                   // 合同编号
            var application_amount = "";                // 申请金额
            var amount_words = "";                          // 金额大写
            var funding_source = "";                    // 预算金额
            var whether_bid = "";
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            if (topic_type_select === "0") {
                alert("请选择议题类型！")
                return false
            }else {
                if (topic_type_select === "1") {
                    pay_type_select = document.getElementById("pay_type_select").value;
                    whether_outweigh_20 = $("input[type=radio][name=whether_outweigh_20]:checked").val();
                    Payee = document.getElementById("Payee").innerText;
                    receiving_account = document.getElementById("receiving_account").innerText;
                    opening_bank = document.getElementById("opening_bank").innerText;
                    application_amount = document.getElementById("application_amount").innerText;
                    amount_words = document.getElementById("amount_words").innerText;
                    funding_source = document.getElementById("funding_source").value;
                    if (pay_type_select === "0") {
                        alert("请选择付款类型！")
                        return false
                    }
                    if (!whether_outweigh_20) {
                        alert("请选择是否转党委会！")
                        return false
                    }
                    if (!Payee) {
                        alert("请填写收款单位！")
                        return false
                    }
                    if (!receiving_account) {
                        alert("请填写收款账号！")
                        return false
                    }
                    if (!opening_bank) {
                        alert("请填写开户行！")
                        return false
                    }
                    if (!application_amount) {
                        alert("请填写申请金额！")
                        return false
                    }
                    if (funding_source === "0") {
                        alert("请选择经费来源！")
                        return false
                    }
                }
                if (topic_type_select === "2") {
                    contract_type_select = document.getElementById("contract_type_select").value;
                    whether_outweigh_20 = $("input[type=radio][name=whether_outweigh_20]:checked").val();
                    Payee = document.getElementById("opposite_unit").innerText;
                    contract_name = document.getElementById("contract_name").innerText;
                    contract_number = document.getElementById("contract_number").innerText;
                    if (pay_type_select === "0") {
                        alert("请选择合同类型！")
                        return false
                    }
                    if (!whether_outweigh_20) {
                        alert("请选择是否转党委会！")
                        return false
                    }
                    if (!Payee) {
                        alert("请填写对方单位！")
                        return false
                    }
                    if (!contract_name) {
                        alert("请填写合同名称！")
                        return false
                    }
                    if (!contract_number) {
                        alert("请填写合同编号！")
                        return false
                    }
                }
                if (topic_type_select === "3") {
                    whether_bid = $("input[type=radio][name=whether_bid_or_not]:checked").val();
                    if (!whether_bid) {
                        alert("请选择是否招标！")
                        return false
                    }
                }
            }
            if (department === '医务科' ||  department === "审计科" || department === "党委办公室" || department === "医院办公室"){
                if (!fg_people){
                    alert("请选择分管领导！");
                    return false
                }
            }
            if (!yb_ytmc){
                alert("议题名称不能为空");
                return false
            }
            if (!yb_ytnr){
                alert("议题内容不能为空");
                return false
            }
            if (!yb_jjfa){
                alert("解决方案不能为空");
                return false
            }

            var yb_xb_split = yb_xb.split(',');var yb_xb_list = [];
            if (yb_xb_split.length >= 1){
                for (var b=0; b<yb_xb_split.length; b++){
                    if (yb_xb_split[b].trim()){
                        yb_xb_list.push(yb_xb_split[b].split("(")[1].slice(0, -1));
                    }
                }
            }

            var yb_send_str = 'number='+String(yb_bh)+'&type='+String("yb")+'&topics_name='+String(yb_ytmc)+'&topics_text='+String(yb_ytnr)+'&topics_basis='+String(yb_ytyj)+'&solution='+String(yb_jjfa)+'&topics_estimate='+String(yb_ygys)+'&nr_wenben='+String(nr_wenben)+'&yj_wenben='+String(yj_wenben)+'&fa_wenben='+String(fa_wenben)+"&ysje="+String(ysje)+"&jfly="+String(jfly)+'&help_department='+JSON.stringify(yb_xb_list)+"&fg_people="+String(fg_people) + "&topic_type_select="+String(topic_type_select) + "&pay_type_select="+String(pay_type_select) + "&whether_outweigh_20="+String(whether_outweigh_20) +
                "&Payee="+String(Payee) + "&receiving_account="+String(receiving_account) + "&opening_bank="+String(opening_bank)+"&application_amount="+String(application_amount)+ "&amount_words=" + String(amount_words) + "&funding_source=" + String(funding_source) + "&contract_type_select="+String(contract_type_select) + "&whether_bid=" + String(whether_bid);
            ajax_request(yb_send_str);
        }

        function summit_data2() {
            var lh_ytmc = document.getElementById("ytmc").innerText;       // 议题名称
            var lh_bh = document.getElementById("bh").innerText;       // 议题编号
            var lh_xb = document.getElementById("xieban").innerText;       // 协办科室
            var lh_ytnr = btoa(encodeURI(UE.getEditor("editor").getContent()));       // 议题内容
            var lh_ygys = document.getElementById("ygys").innerText;       // 预估用时(分钟)
            var nr_wenben = UE.getEditor("editor").getPlainTxt();
            var myselect = document.getElementById("fg_people");
            var index = myselect.selectedIndex;
            var fg_people = myselect.options[index].value;
            if (department === '医务科' ||  department === "审计科" || department === "党委办公室" || department === "医院办公室"){
                if (!fg_people){
                    alert("请选择分管领导！");
                    return false
                }
            }
            if (!lh_ytmc){
                alert("议题名称不能为空");
                return false
            }
            if (!lh_ytnr){
                alert("议题内容不能为空");
                return false
            }
            var regular_table = document.getElementById('party_main');

            var lh_send_str = 'number='+String(lh_bh)+'&type='+String("xz")+'&topics_name='+String(lh_ytmc)+'&topics_text='+String(lh_ytnr)+'&topics_estimate='+String(lh_ygys)+'&nr_wenben='+String(nr_wenben)+"&fg_people="+String(fg_people);
            ajax_request(lh_send_str);
        }

        function ajax_request(send_str) {
            var iss_id = window.location.href.split("id=")[1].replace("#", '');
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_write_detail_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send(send_str+"&id="+String(iss_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 200){
                            window.location.href="/personal-center/topics_list_view";
                        }else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function close_models1() {
            document.getElementById("addForm").style.display = "none";
        }

        function show_model() {
            document.getElementById("addForm").style.display="table-row";
        }

        function summit_val() {
            var cleck_box_list = document.getElementsByClassName("check_box");
            var xuanzhong = ""
            for (var t=0; t<cleck_box_list.length; t++){
                if (cleck_box_list[t].checked){
                    xuanzhong = xuanzhong+cleck_box_list[t].id+", "
                }
            }
            document.getElementById("xieban").innerText=xuanzhong.slice(0, -2);
            document.getElementById("addForm").style.display = "none";
        }

        let title1 = document.querySelector("#title");
        let addForm1 = document.querySelector("#addForm");

        title1.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm1.offsetLeft;
            let y = e.pageY - addForm1.offsetTop;


            document.addEventListener("mousemove", move);
            function move(e) {
                addForm1.style.left = e.pageX - x + 'px';
                addForm1.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        })

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function operate_button(ele_id) {
            var url = window.location.href;
            var id = url.split("id=")[1];
            console.log(ele_id)
            if (ele_id === 'is_stop') {
                var state = 'stop';     // 终止
                var word = '终止'
            }
            var r = confirm('是否' + word + '流程？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/administrative/topics_apply_cancel_view", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("state=" + state + "&id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            alert(JsonDate['message'])
                            window.location.href = '/personal-center/topics_list_view'
                        }
                    }
                };
            }
        }

        function select_topic_type() {
            var choose_type = document.getElementById("topic_type_select").value;
            if (choose_type === "1") {
                document.getElementById("topic_type").setAttribute("colspan", "1");
                document.getElementById("topic_type").style.width = "25%";
                document.getElementById("pay_type_title").style.display = "table-cell";
                document.getElementById("pay_type").style.display = "table-cell";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "table-cell";
                document.getElementById("whether_outweigh").style.display = "table-cell";
                document.getElementById("payment_information").style.display = "table-row";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "table-row";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("ysje1").style.display = "none";
                document.getElementById("ysje").style.display = "none";
                document.getElementById("jfly1").style.display = "none";
                document.getElementById("jfly").style.display = "none";
                document.getElementById("xieban").setAttribute("colspan", "5");
                document.getElementById("xieban").style.width = "85%";
            }else if (choose_type === "2") {
                document.getElementById("topic_type").setAttribute("colspan", "1");
                document.getElementById("topic_type").style.width = "25%";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "table-cell";
                document.getElementById("contract_type").style.display = "table-cell";
                document.getElementById("whether_outweigh_title").style.display = "table-cell";
                document.getElementById("whether_outweigh").style.display = "table-cell";
                document.getElementById("contract_countersigning_tr").style.display = "table-row";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("xieban").removeAttribute("colspan");
                document.getElementById("xieban").style.width = "25%";
            }else if (choose_type === "3") {
                document.getElementById("topic_type").setAttribute("colspan", "3");
                document.getElementById("topic_type").style.width = "53%";
                document.getElementById("WhetherBidTitle").style.display = "table-cell";
                document.getElementById("WhetherBid").style.display = "table-cell";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "none";
                document.getElementById("whether_outweigh").style.display = "none";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("xieban").removeAttribute("colspan");
                document.getElementById("xieban").style.width = "25%";
            }else if (choose_type === "7") {
                document.getElementById("topic_type").setAttribute("colspan", "3");
                document.getElementById("topic_type").style.width = "53%";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "table-cell";
                document.getElementById("whether_outweigh").style.display = "table-cell";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("xieban").removeAttribute("colspan");
                document.getElementById("xieban").style.width = "25%";
            }else {
                document.getElementById("topic_type").setAttribute("colspan", "5");
                document.getElementById("topic_type").style.width = "85%";
                document.getElementById("pay_type_title").style.display = "none";
                document.getElementById("pay_type").style.display = "none";
                document.getElementById("contract_type_title").style.display = "none";
                document.getElementById("contract_type").style.display = "none";
                document.getElementById("whether_outweigh_title").style.display = "none";
                document.getElementById("whether_outweigh").style.display = "none";
                document.getElementById("payment_information").style.display = "none";
                document.getElementById("WhetherBidTitle").style.display = "none";
                document.getElementById("WhetherBid").style.display = "none";
                document.getElementById("contract_countersigning_tr").style.display = "none";
                document.getElementById("payment_capitalization").style.display = "none";
                document.getElementById("ysje1").style.display = "table-cell";
                document.getElementById("ysje").style.display = "table-cell";
                document.getElementById("jfly1").style.display = "table-cell";
                document.getElementById("jfly").style.display = "table-cell";
                document.getElementById("xieban").removeAttribute("colspan");
                document.getElementById("xieban").style.width = "25%";
            }
        }

        function change_daxie(this_) {
            let reg = new RegExp("[\\u4E00-\\u9FFF]+","g")
            var application_amount = document.getElementById("application_amount").innerText;
            if(reg.test(application_amount)){
                alert("请输入纯数字！")
                return false
            }
            this_.innerText = formatMonenyNumber(application_amount.replace(",", '').replace(",", '').replace(",", '').replace(",", '').replace(",", ''))
            document.getElementById("amount_words").innerText=ToString(application_amount);
        }

        function formatMonenyNumber(number, toFixed = 2) {
            let str = [];
            if (!number) return 0
            if (typeof number === "number") number = String(number)
            let tempNumber = number.split('.');
            number = tempNumber[0]
            if (number.length <= 3) {
                if (tempNumber[1]) {
                    number += '.' + tempNumber[1].slice(0, toFixed);
                }else {
                    number += '.00'
                }
                return number
            }
            number.split('').reverse().forEach((item, index) => {
                if (index !== 0 && index % 3 === 0) {
                    str.push(',', item)
                } else {
                    str.push(item)
                }
            })
            number = str.reverse().join('')
            if (tempNumber[1]) {
                var decimils = tempNumber[1].slice(0, toFixed);
                if (decimils.length === 1){
                    decimils = decimils + "0";
                }
                number += '.' + decimils;
            }else {
                 number += '.00'
            }
            return number;
        }

        function ToString(money) {
            console.log(money, '执行了吗');
            //汉字的数字
            var cnNums = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
            //基本单位
            var cnIntRadice =['', '拾', '佰', '仟'];
            //对应整数部分扩展单位
            var cnIntUnits = ['', '万', '亿', '兆'];
            //对应小数部分单位
            var cnDecUnits = ['角', '分', '毫', '厘'];
            //整数金额时后面跟的字符
            var cnInteger = '整';
            //整型完以后的单位
            // var cnIntLast = '圆';
            var cnIntLast = '元';
            //最大处理的数字
            var maxNum = 999999999999999.9999;
            //金额整数部分
            var integerNum;
            //金额小数部分
            var decimalNum;
            //输出的中文金额字符串
            var chineseStr = '';
            //分离金额后用的数组，预定义
            var parts;
            if (money === '') { return ''; }
            money = parseFloat(money);
            if (money >= maxNum) {
                //超出最大处理数字
                return '';
            }
            if (money === 0) {
                chineseStr = cnNums[0] + cnIntLast + cnInteger;

                return chineseStr;
            }

            //转换为字符串
            money = money.toString();

            if (money.indexOf('.') === -1) {
                integerNum = money;
                decimalNum = '';
            } else {
                parts = money.split('.');
                integerNum = parts[0];

                decimalNum = parts[1].substring(0, 2);
            }
            //获取整型部分转换
            if (parseInt(integerNum, 10) > 0) {
                var zeroCount = 0;
                var IntLen = integerNum.length;
                for (var i = 0; i < IntLen; i++) {
                    // var n = integerNum.substr(i, 1);
                    var n = integerNum.substring(i, i+1);
                    var p = IntLen - i - 1;
                    var q = p / 4;
                    var m = p % 4;
                    if (n === '0') {
                        zeroCount++;
                    } else {
                        if (zeroCount > 0) {
                            chineseStr += cnNums[0];
                        }
                        //归零
                        zeroCount = 0;
                        chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
                    }
                    if (m === 0 && zeroCount < 4) {
                        chineseStr += cnIntUnits[q];
                    }
                }
                chineseStr += cnIntLast;
            }
            //小数部分
            if (decimalNum !== '') {
                var decLen = decimalNum.length;
                for (var i = 0; i < decLen; i++) {
                    // var n = decimalNum.substr(i, 1);
                    var n = decimalNum.substring(i, i+1);
                    if (n !== '0') {
                        // chineseStr += cnNums[Number(n)] + cnDecUnits[i];
                        chineseStr += cnNums[parseInt(n)] + cnDecUnits[i];
                    }
                }
            }
            if (chineseStr === '') {
                chineseStr += cnNums[0] + cnIntLast + cnInteger;
            } else if (decimalNum === '') {
                chineseStr += cnInteger;
            }

            return chineseStr;
        }
    </script>
{% endblock %}
